﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace WPFCouse
{
    /// <summary>
    /// FrameWindow.xaml 的交互逻辑
    /// </summary>
    public partial class FrameWindow : Window
    {
        public FrameWindow()
        {
            InitializeComponent();
        }

        private void Button_Click(object sender, RoutedEventArgs e)
        {
            //导航到另一页
            //1.
            // framePage.Navigate(new Uri("UserInfoPage.xaml", UriKind.Relative));
            //2.
            UserInfoPage userPage = new UserInfoPage();
            //framePage.Navigate(userPage);
            //3.
            //framePage.NavigationService.Navigate(userPage,"userInfo");
            //framePage.LoadCompleted += FramePage_LoadCompleted;
            //4.
            framePage.Content = userPage;
        }

        private void FramePage_LoadCompleted(object sender, System.Windows.Navigation.NavigationEventArgs e)
        {
            if(e.ExtraData!=null)
            {
                MessageBox.Show(e.ExtraData.ToString());
            }
        }
    }
}
